home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / close.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  911b  |  47 lines

  1. /* Close.c   V1.0   93-03-15                        */
  2. /* ROM library: "dos.library/Close", (All versions) */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club      */
  4.  
  5. #include <dos/dos.h>
  6.  
  7. #include <clib/dos_protos.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. UBYTE *version = "$VER: Close 1.0";
  12.  
  13. int main( int argc, char *argv[] );
  14. int main( int argc, char *argv[] )
  15. {
  16.   BPTR my_file;
  17.  
  18.  
  19.   /* Open a new file: */
  20.   my_file = Open( "RAM:Score.dat", MODE_NEWFILE );
  21.   
  22.   /* OK? */
  23.   if( !my_file )
  24.   {
  25.     /* Could not open the file! */
  26.     printf( "Error! Could not open the file!\n" );
  27.     exit( 20 );
  28.   }
  29.   printf( "File open!\n" );
  30.  
  31.  
  32.   /* - - - */
  33.  
  34.  
  35.   /* Close the file: */
  36.   if( Close( my_file ) )
  37.     printf( "File closed!\n" );
  38.   else
  39.     printf( "Error! File could not be closed!\n" );
  40.  
  41.   /* Remember that even if the file could not be */
  42.   /* closed we must NOT try to close it again!   */
  43.  
  44.   exit( 0 );
  45. }
  46.  
  47.